package com.iplant.ams.service.po.ams.fxt;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.ams.service.basicenum.ams.fxt.AMSFrockType;
import com.iplant.ams.service.po.ams.asset.AMSAssetStandardModel;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.base.utils.annotation.join.multi.DBJoinMulti;
import com.iplant.base.utils.annotation.po.DBBasePO;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 工装
 *
 * @author YouWang·Peng
 * 2023-7-24 19:49:02
 */
@DBBasePO(TableName = "ams_frocktool", CheckName = {"StandardModelID"},
        Name = false, Code = false, Active = false,
        Schemas = DBSchemas.AMS, CodeAuto = true, CodePrefix =
        "GZ-", CodeNum = 4)
public class AMSFrockTool extends BasePO implements Serializable {

    /**
     * 序列号
     */
    private static final long serialVersionUID = 1L;

    @DBCondition
    @DBField
    public int StandardModelID = 0;//资产标准型号ID
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "ams_asset_standard_model", tableAsName = "a1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "StandardModelID")
    public String Name = "";

    /**
     * 标准型号编码
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Code", tableName = "ams_asset_standard_model", tableAsName = "a1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "StandardModelID")
    public String Code = "";

    @DBCondition
    @DBJoin(name = "Active", tableName = "ams_asset_standard_model", tableAsName = "a1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "StandardModelID")
    public int Active = 0;



    @DBCondition
    @DBJoin(name = "ClassificationID", tableName = "ams_asset_standard_model", tableAsName = "a1",
            Schemas =
                    DBSchemas.AMS, MainTableField
            = "StandardModelID")
    public int ClassificationID = 0;//资产分类ID

    @DBJoin(name = "Name", tableName = "ams_asset_classification", tableAsName = "classification1",
            Schemas =
                    DBSchemas.AMS, ConditionalJoin = "classification1.ID=a1.ClassificationID")
    public String ClassificationName = "";//资产分类名称

    @DBJoin(name = "Code", tableName = "ams_asset_classification", tableAsName = "classification1", Schemas =
            DBSchemas.AMS,
            JoinIndex = 2, ConditionalJoin
            = "classification1.ID=a1.ClassificationID")
    public String ClassificationCode = "";//资产分类编码


    /**
     * 工装类型
     */
    @DBCondition
    @DBField
    public int FrockType = 0;
    /**
     * 工装类型文本
     */
    public String FrockTypeText = "";



    /**
     * 工装规格
     */
    @DBJoin(name = "AssetModel", tableName = "ams_asset_standard_model", tableAsName = "a1",
            Schemas =
                    DBSchemas.AMS, MainTableField
            = "StandardModelID")
    public String Specifications = "";


    /**
     * 可以安装设备ID
     **/
    @DBCondition(CompareType = DBCondition.DBCompareType.findInSet)
    @DBField
    public List<Integer> DeviceIDList = new ArrayList<Integer>();
    /**
     * 设备名称
     **/
    @DBJoinMulti(Name = "Name", TableName = "dms_device_ledger", MainTableField = "DeviceIDList", Schemas =
            DBSchemas.AMS)
    public String DeviceName = "";

    @DBJoinMulti(Name = "Code", TableName = "dms_device_ledger", MainTableField = "DeviceIDList", Schemas =
            DBSchemas.AMS)
    public String DeviceCode = "";
    /**
     * 默认存放位置
     */
    @DBField
    public String Position = "";



    public AMSFrockTool() {
        super();
    }



    public AMSFrockTool(AMSAssetStandardModel wAMSAssetStandardModel, AMSFrockType wAMSFrockType){
        super();

        Name=wAMSAssetStandardModel.Name;
        Code=wAMSAssetStandardModel.Code;
        StandardModelID =wAMSAssetStandardModel.ID;
        Specifications=wAMSAssetStandardModel.AssetModel;
        Active=wAMSAssetStandardModel.Active;
        FrockType=wAMSFrockType.getValue();

    }


    @JsonProperty("StandardModelID")
    public int getStandardModelID() {
        return StandardModelID;
    }

    public void setStandardModelID(int StandardModelID) {
        this.StandardModelID = StandardModelID;
    }

    @JsonProperty("Code")
    public String getCode() {
        return Code;
    }

    public void setCode(String Code) {
        this.Code = Code;
    }

    @JsonProperty("Name")
    public String getName() {
        return Name;
    }

    public void setName(String Name) {
        this.Name = Name;
    }

    @JsonProperty("ClassificationID")
    public int getClassificationID() {
        return ClassificationID;
    }

    public void setClassificationID(int classificationID) {
        ClassificationID = classificationID;
    }

    @JsonProperty("ClassificationName")
    public String getClassificationName() {
        return ClassificationName;
    }

    public void setClassificationName(String classificationName) {
        ClassificationName = classificationName;
    }

    @JsonProperty("ClassificationCode")
    public String getClassificationCode() {
        return ClassificationCode;
    }

    public void setClassificationCode(String classificationCode) {
        ClassificationCode = classificationCode;
    }

    @JsonProperty("FrockType")
    public int getFrockType() {
        return FrockType;
    }

    public void setFrockType(int frockType) {
        FrockType = frockType;
    }

    @JsonProperty("FrockTypeText")
    public String getFrockTypeText() {
        FrockTypeText = AMSFrockType.getEnumType(FrockType).getLabel();
        return FrockTypeText;
    }

    public void setFrockTypeText(String frockTypeText) {
        FrockTypeText = frockTypeText;
    }

    @JsonProperty("Specifications")
    public String getSpecifications() {
        return Specifications;
    }

    public void setSpecifications(String specifications) {
        Specifications = specifications;
    }

    @JsonProperty("Position")
    public String getPosition() {
        return Position;
    }

    public void setPosition(String position) {
        Position = position;
    }


    @JsonProperty("Active")
    public int getActive() {
        return Active;
    }

    public void setActive(int Active) {
        this.Active = Active;
    }

    @JsonProperty("DeviceIDList")
    public List<Integer> getDeviceIDList() {
        return DeviceIDList;
    }

    public void setDeviceIDList(List<Integer> deviceIDList) {
        DeviceIDList = deviceIDList;
    }
    @JsonProperty("DeviceName")
    public String getDeviceName() {
        return DeviceName;
    }

    public void setDeviceName(String deviceName) {
        DeviceName = deviceName;
    }
    @JsonProperty("DeviceCode")
    public String getDeviceCode() {
        return DeviceCode;
    }

    public void setDeviceCode(String deviceCode) {
        DeviceCode = deviceCode;
    }


}
